<template>
	<div class="view">
		<template>
			<Top :title="'招聘信息审核'"></Top>
		</template>
		<div class="main">
			<div class="main_con">
				<div class="main_title">招聘信息审核</div>
				<div class="main_view">
					<el-form label-position="top" :model="form" ref="form">
						<el-form-item label="企业名称" prop="title">
							<el-input class="input" v-model="form.companyTitle" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="职位名称" prop="title">
							<el-input class="input" v-model="form.title" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="所属行业" prop="hangye">
							<el-input class="input" v-model="form.hangye" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="招聘岗位" prop="gangwei">
							<el-input class="input" v-model="form.gangwei" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="职位要求" prop="need">
							<el-input type="textarea" :rows="5" class="input" v-model="form.need" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="工作内容" prop="workCnt">
							<el-input type="textarea" :rows="5" class="input" v-model="form.workCnt" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="工作形式" prop="workType">
							<el-input class="input" v-model="form.workType" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="学历要求" prop="workEducation">
							<el-input class="input" v-model="form.workEducation" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="工作时间" prop="workTime">
							<el-input class="input" v-model="form.workTime" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="工作经验" prop="workExperience">
							<el-input class="input" v-model="form.workExperience" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="工作薪资" prop="workSalary">
							<el-input class="input" v-model="form.workSalary" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="薪资单位" prop="workDanwei">
							<el-input class="input" v-model="form.workDanwei" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="工作省份" prop="province">
							<el-input class="input" v-model="form.province" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="工作城市/区" prop="city">
							<el-input class="input" v-model="form.city" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="详细地址" prop="addr">
							<el-input class="input" v-model="form.addr" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="服务标签" prop="tip">
							<el-input class="input" v-model="form.tip" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="是否提供带教服务" prop="isDaijiao">
							<el-input class="input" v-model="form.isDaijiao" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="带教单位" prop="daijiaoCompany">
							<el-input class="input" v-model="form.daijiaoCompany" :disabled="true"></el-input>
						</el-form-item>
						<el-form-item label="招聘截止时间" prop="timeEnd">
							<el-input class="input" v-model="form.timeEnd" :disabled="true"></el-input>
						</el-form-item>
					</el-form>

				</div>
				<div class="saveBtn">
					<el-button type="primary" size="medium" @click="save(0)" :disabled="isAdd" v-if="this.form.status!=0">审核通过</el-button>
					<el-button type="danger" size="medium" @click="save(2)" :disabled="isAdd" v-if="this.form.status!=2">审核拒绝</el-button>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import Top from "../../components/top.vue";
import { mapState } from "vuex"
export default {
	components: {
		Top
	},
	data() {
		return {
			form: {
				id: 0,         //主键

			},
			isAdd: false,

		}
	},
	computed: {
		...mapState(['urlParma'])
	},
	methods: {

		// 保存
		save(item) {
			this.$http({
				'method': 'post',
				'url': this.$api.pinStatus,
				data: {
					id:this.form.id,
					status:item
				}
			}).then(res => {
				if (res.data.code == 20000) {
					this.$message.success(res.data.message)
					this.$router.go(-1)
				} else {
					this.$message.error(res.data.message)
				}
				this.isAdd = false
			})
		},
		

		// 获取详情
		dataInit() {
			this.$http({
				'method': 'get',
				'url': this.$api.pinDetail + this.urlParma.id,
			}).then(res => {
				if (res.data.code == 20000) {
					console.log(res.data.data.detail)
					let detail = res.data.data.detail
					let company = res.data.data.company

					this.form = detail

					this.form.isDaijiao = (detail.isDaijiao && detail.isDaijiao==1) ?"是":"否"
					this.form.timeEnd = detail.isLong==1 ?"长期":detail.timeEnd
					this.form.workSalary = detail.isMianyi==1 ?"面议":detail.workSalary
					this.form.companyTitle = company.title
				}
			})
		},

	},
	created() {
		this.dataInit()
	}
}
</script>

<style scoped>
@import url(../../assets/css/userAdd.css);
</style>
